package com.tianji.learning.schedule;

import com.tianji.learning.service.ILearningLessonService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时任务 扫描课表 将课程状态修改为已过期
 */
@Component
@Slf4j
@RequiredArgsConstructor
public class LessonStatusCheckScheduled {

    private final ILearningLessonService learningLessonService;

    //
    @Scheduled(cron = "0 0 0 * * ?")
    public void checkLessonStatus() {
        log.info("定时任务扫描课表，将课程状态修改为已过期");
        learningLessonService.checkLessonStatus();
    }
}
